#include "analysis.h"

using namespace std;
int main(int argc, char** argv){
	for(int i=1;i<argc;i++){
		printf("argv[%d] = %s\n\n",i,argv[i]);
	}
	TString read_list= argv[1];
	TString output = argv[2];
	TString input = argv[3];
	TString options = argv[4];
	
        TChain *fchain=new TChain("physics");

  TString filename;
  ifstream fin(input,ios::in);
  Int_t n=0;

if(read_list=="1"){
  cout<<" DATA SETS:"<<endl;
  while(fin>>filename){
    if (!filename.BeginsWith("#")) {
    cout<<filename<<endl;
      fchain->Add(filename);
      n++;
    }
  }
}
else if(read_list=="2"){
fchain->Add(input);
}

	physics* ana = new physics(fchain,output.Data(),options.Data());
	//int numevt = ana->fChain->GetEntries();
	cout<<"before count numbers "<<endl;
	int numevt = fchain->GetEntries();
	cout<<"Number of events: "<<numevt<<endl;
		fchain->Process(ana);
   
	delete ana;
	cout<<"DONE"<<endl;



	cout<<"Clone DONE"<<endl;
}
